import React from "react";
import logo from "../../images/logo.png";
import "./index.css";
import { Button } from "antd";
import adb from '../../images/adb.png'
import zbj from '../../images/zbj.jpg'
import { useNavigate } from "react-router-dom";
const Index = () => {
  const user = JSON.parse(localStorage.getItem('user'))||{}
  // console.log(user);
  const navigate = useNavigate()
  const handelClose = ()=> {
    localStorage.removeItem('user')
    localStorage.removeItem('token')
    navigate('/login')
  }
  return (
    <div className="header_box">
      <div className="let_box">
        <img src={logo} className="logo" alt="" />
        <h1>奥德彪管理系统</h1>
      </div>
      <div className="rig_box">
        <dl >
          <dt>
            <img src={user.name==='资本家'?zbj:adb} alt="" />
          </dt>
          <dd>
            <div>name:{user.name}</div>
            <div>role:{user.role}</div>
            <div>格言：{user.motto}</div>
          </dd>
        </dl>
        <Button type='primary' danger onClick={()=>handelClose()}>退出登录</Button>
      </div>
    </div>
  );
};

export default Index;
